﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using testProject.ViewModel;
using System.Collections.ObjectModel;

namespace testProject
{
    /// <summary>
    /// Interaction logic for Page1.xaml
    /// </summary>
    public partial class Page1 : Page
    {
        public Page1()
        {
            InitializeComponent();
            Statuses = new ObservableCollection<string>();
            Statuses.Add("asdfasdf");
            this.Loaded += new RoutedEventHandler(Page1_Loaded);
        }

        void Page1_Loaded(object sender, RoutedEventArgs e)
        {
            DataContext = this;
        }
        public string LoadTime
        {
            get { return (string)GetValue(LoadTimeProperty); }
            set { SetValue(LoadTimeProperty, value); }
        }

        // Using a DependencyProperty as the backing store for LoadTime.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty LoadTimeProperty =
            DependencyProperty.Register("LoadTime", typeof(string), typeof(Page1), new UIPropertyMetadata(DateTime.Now.ToLongTimeString()));

        public SaveCommander CopyCommand
        {
            get { return (SaveCommander)GetValue(CopyCommandProperty); }
            set { SetValue(CopyCommandProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CopyCommand.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CopyCommandProperty =
            DependencyProperty.Register("CopyCommand", typeof(SaveCommander), typeof(Page1), new UIPropertyMetadata(new SaveCommander()));

        public ObservableCollection<string> Statuses { get; set; }

        public class SaveCommander : ICommand
        {
            #region ICommand Members

            public bool CanExecute(object parameter)
            {
                return true;
            }

            public event EventHandler CanExecuteChanged;

            public void Execute(object parameter)
            {
                MessageBox.Show(parameter.ToString());
            }

            #endregion
        }
    }

    public class PageBase : Page
    {

    }
}
